.class public Lcom/instagram/android/explore/widget/SnapToGridListView;
.super Landroid/widget/ListView;
.source "SnapToGridListView.java"

# interfaces
.implements Landroid/widget/AbsListView$OnScrollListener;


# instance fields
.field private a:I

.field private b:I

.field private c:I

.field private d:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 0
    .parameter "context"

    .prologue
    .line 25
    invoke-direct {p0, p1}, Landroid/widget/ListView;-><init>(Landroid/content/Context;)V

    .line 26
    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->a()V

    .line 27
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 0
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 30
    invoke-direct {p0, p1, p2}, Landroid/widget/ListView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 31
    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->a()V

    .line 32
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 0
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    .line 35
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/ListView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 36
    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->a()V

    .line 37
    return-void
.end method


# virtual methods
.method public a()V
    .locals 3

    .prologue
    const v2, 0x106000d

    .line 40
    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    sget v1, Lcom/facebook/au;->explore_people_spacing_photo_grid:I

    invoke-virtual {v0, v1}, Landroid/content/res/Resources;->getDimension(I)F

    move-result v0

    float-to-int v0, v0

    iput v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->a:I

    .line 42
    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->getContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    invoke-virtual {v0, v2}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v0

    invoke-virtual {p0, v0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->setDivider(Landroid/graphics/drawable/Drawable;)V

    .line 43
    iget v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->a:I

    invoke-virtual {p0, v0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->setDividerHeight(I)V

    .line 44
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->setFadingEdgeLength(I)V

    .line 45
    const/4 v0, 0x2

    invoke-virtual {p0, v0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->setOverScrollMode(I)V

    .line 46
    invoke-virtual {p0, v2}, Lcom/instagram/android/explore/widget/SnapToGridListView;->setSelector(I)V

    .line 48
    invoke-virtual {p0, p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->setOnScrollListener(Landroid/widget/AbsListView$OnScrollListener;)V

    .line 49
    return-void
.end method

.method public getRowCount()I
    .locals 1

    .prologue
    .line 83
    iget v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->b:I

    return v0
.end method

.method protected onMeasure(II)V
    .locals 5
    .parameter "widthMeasureSpec"
    .parameter "heightMeasureSpec"

    .prologue
    const/high16 v4, 0x4000

    .line 53
    invoke-static {p1}, Landroid/view/View$MeasureSpec;->getSize(I)I

    move-result v1

    .line 54
    invoke-static {p2}, Landroid/view/View$MeasureSpec;->getSize(I)I

    move-result v2

    .line 60
    iget v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->a:I

    mul-int/lit8 v0, v0, 0x2

    sub-int v0, v1, v0

    div-int/lit8 v0, v0, 0x3

    iput v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->c:I

    .line 61
    iget v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->c:I

    mul-int/lit8 v0, v0, 0x2

    iget v3, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->a:I

    add-int/2addr v0, v3

    .line 66
    if-lt v2, v1, :cond_0

    .line 68
    const/4 v0, 0x3

    iput v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->b:I

    move v0, v1

    .line 78
    :goto_0
    invoke-static {v1, v4}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v1

    invoke-static {v0, v4}, Landroid/view/View$MeasureSpec;->makeMeasureSpec(II)I

    move-result v0

    invoke-super {p0, v1, v0}, Landroid/widget/ListView;->onMeasure(II)V

    .line 80
    return-void

    .line 69
    :cond_0
    if-ge v2, v0, :cond_1

    .line 70
    iget v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->c:I

    .line 71
    iget v2, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->c:I

    iget v3, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->a:I

    add-int/2addr v2, v3

    iput v2, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->c:I

    .line 72
    const/4 v2, 0x1

    iput v2, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->b:I

    goto :goto_0

    .line 75
    :cond_1
    const/4 v2, 0x2

    iput v2, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->b:I

    goto :goto_0
.end method

.method public onScroll(Landroid/widget/AbsListView;III)V
    .locals 0
    .parameter "view"
    .parameter "firstVisibleItem"
    .parameter "visibleItemCount"
    .parameter "totalItemCount"

    .prologue
    .line 133
    return-void
.end method

.method public onScrollStateChanged(Landroid/widget/AbsListView;I)V
    .locals 5
    .parameter "view"
    .parameter "scrollState"

    .prologue
    const/4 v4, 0x0

    .line 88
    if-nez p2, :cond_2

    .line 91
    invoke-virtual {p1, v4}, Landroid/widget/AbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v0

    invoke-virtual {v0}, Landroid/view/View;->getTop()I

    move-result v0

    mul-int/lit8 v1, v0, -0x1

    .line 94
    iget v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->c:I

    iget v2, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->a:I

    add-int/2addr v2, v0

    .line 100
    invoke-virtual {p1}, Landroid/widget/AbsListView;->getFirstVisiblePosition()I

    move-result v0

    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->getMeasuredWidth()I

    move-result v3

    mul-int/2addr v0, v3

    invoke-virtual {p1, v4}, Landroid/widget/AbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v3

    invoke-virtual {v3}, Landroid/view/View;->getTop()I

    move-result v3

    sub-int/2addr v0, v3

    .line 105
    int-to-float v3, v2

    iget v4, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->d:I

    if-le v0, v4, :cond_1

    const v0, 0x3f2ac083

    :goto_0
    mul-float/2addr v0, v3

    float-to-int v0, v0

    .line 110
    add-int/2addr v0, v1

    .line 111
    div-int/2addr v0, v2

    .line 112
    mul-int/2addr v0, v2

    .line 114
    sub-int/2addr v0, v1

    .line 116
    new-instance v1, Lcom/instagram/android/explore/widget/b;

    invoke-direct {v1, p0, v0}, Lcom/instagram/android/explore/widget/b;-><init>(Lcom/instagram/android/explore/widget/SnapToGridListView;I)V

    invoke-virtual {p0, v1}, Lcom/instagram/android/explore/widget/SnapToGridListView;->post(Ljava/lang/Runnable;)Z

    .line 128
    :cond_0
    :goto_1
    return-void

    .line 105
    :cond_1
    const v0, 0x3eaa7efa

    goto :goto_0

    .line 122
    :cond_2
    const/4 v0, 0x1

    if-ne p2, v0, :cond_0

    .line 124
    invoke-virtual {p1}, Landroid/widget/AbsListView;->getFirstVisiblePosition()I

    move-result v0

    invoke-virtual {p0}, Lcom/instagram/android/explore/widget/SnapToGridListView;->getMeasuredWidth()I

    move-result v1

    mul-int/2addr v0, v1

    invoke-virtual {p1, v4}, Landroid/widget/AbsListView;->getChildAt(I)Landroid/view/View;

    move-result-object v1

    invoke-virtual {v1}, Landroid/view/View;->getTop()I

    move-result v1

    sub-int/2addr v0, v1

    iput v0, p0, Lcom/instagram/android/explore/widget/SnapToGridListView;->d:I

    goto :goto_1
.end method
